package com.ruyuan.eshop.manager.controller.aftersale;

import com.ruyuan.eshop.framework.core.WebPage;
import com.ruyuan.eshop.common.domain.dto.AfterSaleQueryParam;
import com.ruyuan.eshop.common.domain.vo.AfterSaleExportVO;
import com.ruyuan.eshop.common.domain.vo.ApplyAfterSaleVO;
import com.ruyuan.eshop.common.enums.Permission;
import com.ruyuan.eshop.common.service.aftersale.AfterSaleQueryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 售后服务相关API
 * @author pwd
 * @version 1.0
 */
@Api(description = "售后服务相关API")
@RestController
@RequestMapping("/admin/v1.0/after-sales")
@Validated
public class AfterSaleManagerController {

    @Autowired
    private AfterSaleQueryService afterSaleQueryService;

    /**
     * 获取申请售后服务记录列表
     * @param param
     * @return
     */
    @ApiOperation(value = "获取申请售后服务记录列表")
    @GetMapping
    public WebPage list(@Valid AfterSaleQueryParam param){
        return afterSaleQueryService.list(param);
    }

    /**
     * 获取售后服务详细信息
     * @param serviceSn
     * @return
     */
    @ApiOperation(value = "获取售后服务详细信息")
    @GetMapping(value = "/detail/{service_sn}")
    public ApplyAfterSaleVO detail(@PathVariable("service_sn") String serviceSn){
        return afterSaleQueryService.detail(serviceSn, Permission.ADMIN);
    }
}
